import { defineConfig } from "vite";
import { fileURLToPath, URL } from "node:url";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue(), vueJsx()],
    server: {
        port: 8010,
        // 反向代理配置
        proxy: {
            // 功能接口代理
            "/api": {
                target: "http://localhost:5010/",
            },
                        // OAuth2地址清单终结点代理
            "/.well-known": {
                target: "http://localhost:5010/",
                xfwd: true,
            },
            // OAuth2的token获取终结点代理
            "/connect": {
                target: "http://localhost:5010/",
                xfwd: true,
            },
            // OAuth2的MVC登录页代理
            "/Account": {
                target: "http://localhost:5010/",
                xfwd: true,
            },
            // OAuth2的MVC页样式表代理
            "/css": {
                target: "http://localhost:5010/",
            },
            // OAuth2的MVC页图片代理
            "/images": {
                target: "http://localhost:5010/",
            }
        },
    },
    resolve: {
        alias: {
            "@": fileURLToPath(new URL("./src", import.meta.url)),
        },
    },
});
